﻿using KursnaListaService.Models;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace KursnaListaService.Controllers
{
    public class LatestController : ApiController
    {
        // GET api/latest/5
        public IEnumerable<KursnaListaZaDan> Get(int days)
        {
            var repo = new Repository(ConfigurationManager.ConnectionStrings["DataConnection"].ConnectionString);
            var  last = repo.GetKursnaListaZaNDana(days).Last();
            return new [] {last};
        }
    }
}
